
for t = 1:numel(files)
  
    % PLOT DATA
    
    figure(1)
    switch trialsummary(1,t).speed.deg
        case 22
            subplot(2,1,1);
            if trialsummary(1,t).stimulus.smooth == 0 % Fast Noisy
                fnp = plot(trialsummary(1,t).data.X);
                hold on
            else                                      % Fast Smooth
                fsp = plot(trialsummary(1,t).data.X,'-r');
                hold on
            end
            
        case 18
            subplot(2,1,2);
            if trialsummary(1,t).stimulus.smooth == 0 % Slow Noisy
                snp = plot(trialsummary(1,t).data.X);
                hold on
            else                                      % Slow Smooth
                ssp = plot(trialsummary(1,t).data.X,'-r');
                hold on
            end
    end
end

% PLOT TARGET TRACE & OCCLUDERS

figure(1)
subplot(2,1,1);
xlabel('Time (ms)');
ylabel('Displacement (pixels)')
legend([fsp,fnp],'22 deg/s Smooth','22 deg/s Noisy','Location','SouthEast')
legend boxoff
title('All trials at 22 deg/s','FontWeight','bold')
plot(target22.X,'-k','LineWidth',2)

for i = 1:6
    patch(target22.plotocc.x(i,:),target22.plotocc.y(i,:),[0.9,0.9,0.9]);
    set(patch,'facealpha',0.1)
end

subplot(2,1,2);
xlabel('Time (ms)');
ylabel('Displacement (pixels)')
legend([ssp,snp],'18 deg/s Smooth','18 deg/s Noisy','Location','SouthEast')
legend boxoff
title('All trials at 18 deg/s','FontWeight','bold')
plot(target18.X,'-k','LineWidth',2)

for i = 1:6
    patch(target18.plotocc.x(i,:),target18.plotocc.y(i,:),[0.9,0.9,0.9]);
    set(patch,'facealpha',0.1)
end

suplabel(subject,'t')
